//
//  ViewController.m
//  CXXChooseImage
//
//  Created by Qun on 16/9/30.
//  Copyright © 2016年 Qun. All rights reserved.
//

#import "ViewController.h"
#import "CXXChooseImageViewController.h"
@interface ViewController ()<CXXChooseImageViewControllerDelegate>
/** <#name#> */
@property (nonatomic, strong) CXXChooseImageViewController *vc;

/** <#name#> */
@property (nonatomic, strong) UILabel *redLable;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    CXXChooseImageViewController *vc = [[CXXChooseImageViewController alloc] init];
    vc.delegate = self;
    self.vc = vc;
    [self addChildViewController:vc];

    [vc setOrigin:CGPointMake(0, 200) ItemSize:CGSizeMake(50, 50) rowCount:4]; //注意要满足 ItemSize的宽度 * rowCount < 屏幕宽度
    [self.view addSubview:vc.view];
    
    vc.maxImageCount = 9;
    
    
    UILabel *redLable = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.vc.view.frame), [UIScreen mainScreen].bounds.size.width, 30)];
    [self.view addSubview:redLable];
    redLable.text = @"我可以跟随照片的换行而改变位置";
    redLable.backgroundColor = [UIColor redColor];
    self.redLable = redLable;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [super touchesBegan:touches withEvent:event];
    NSLog(@"%@", _vc.dataArr);
}
- (void)chooseImageViewControllerDidChangeCollectionViewHeigh:(CGFloat)height{
    self.vc.view.frame =  CGRectMake(0, 200, [[UIScreen mainScreen] bounds].size.width, height);
    
    self.redLable.frame = CGRectMake(0, CGRectGetMaxY(self.vc.view.frame), [UIScreen mainScreen].bounds.size.width, 30);
}


@end
